package me.sealer.jmx.agent;

import ch.qos.logback.classic.LoggerContext;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.LoggerFactory;

/**
 * @author sealer
 * @date 2018/01/22.
 */
@Slf4j
public class ReloadConfigJmxStarter {
    public static LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
//    private static Logger logger = lc.getLogger("CONSOLE");

    /**
     * 模拟应用日志打印
     */
    public void applicationLogPrinting() {
        int i = 0;
        System.out.println(log.getName());
        for (int j = 0; j < 300; j++) {
            System.out.println("测试第 " + ++i + "次循环，请注意观察控制台输出");
            log.trace("do trace");
            log.debug("do debug");
            log.info("do info");
            log.warn("do warn");
            log.error("do error");
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }

    public static void main(String[] args) throws Exception {
        ReloadConfigJmx.init(lc);
        new ReloadConfigJmxStarter().applicationLogPrinting();
    }
}
